<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

/**
 *  IP黑名单
 */
class IpBlacklist extends Model
{
    protected $table = 'ip_blacklist';
    protected $fillable = ['client_ip', 'flag'];

    static function addIp($clientIp = '')
    {
        $where = ['client_ip' => $clientIp];
        $info = ['client_ip' => $clientIp, 'flag' => 1];
        return self::updateOrCreate($where, $info);
    }
}
